package leetcode.editor.vscdev.greedy;

public class lc122 {
    
}

class Solution {
    public int maxProfit(int[] prices) {
        return func1(prices);
    }

    private int func1(int[] prices) {
        // 贪心算法
        int maxProfit = 0;
        for (int i = 1; i < prices.length; i++) {
            if (prices[i] > prices[i - 1]) {
                maxProfit += prices[i] - prices[i - 1];
            }
        }
        return maxProfit;
    }
    private int func2(int[] prices) {
        // TODO 动态规划
        return 0;
    }
}